/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.edmo.fastener.parser;

import com.edmo.fastener.business.ListofCustomersnSuppliers;
import com.edmo.fastener.domain.Supplier;
import com.edmo.fastener.slave.IocBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author Alexx
 */
public class ParseSuppliers extends AbstractParser {
    
    private ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Module.xml");
    
    public void readnParse(){
        IocBean ioc = (IocBean) context.getBean("suppliers");
        readFile(ioc.getName());
    }

    @Override
    public void parse(String s) {
        String[] arr = s.split("\\|");
        Supplier list = new Supplier(arr[0], arr[1], arr[2], arr[3], Integer.valueOf(arr[4]), Integer.valueOf(arr[5]));
        ListofCustomersnSuppliers.getInstance().getSuppliers().add(list);
    }
    
}
